package cn.com.headfree.competent.service.impl;

import cn.com.headfree.entity.TSeniorCompetentHandle;
import cn.com.headfree.competent.dao.TSeniorCompetentHandleDao;
import cn.com.headfree.competent.service.TSeniorCompetentHandleService;
import com.gta.edu.sdk.util.IdGen;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;


@Service("tSeniorCompetentHandleService")
public class TSeniorCompetentHandleServiceImpl implements TSeniorCompetentHandleService {

	@Autowired
	private TSeniorCompetentHandleDao tSeniorTechnicianHandleDao;

	@Override
	public void solveData(String erpNo,String id, String isHide,String seniorId) {
		TSeniorCompetentHandle handle = new TSeniorCompetentHandle();
		if(isHide.equals("0")){//由可见变隐藏
			handle.setId(IdGen.uuid());
			handle.setErpNo(erpNo);
			handle.setBusinessId(id);//业务表ID
			handle.setSeniorId(seniorId);//申报技能的数据ID
			handle.setIsHide(isHide);
			handle.setCreaterId(erpNo);
			handle.setCreateTime(new Date());
			tSeniorTechnicianHandleDao.saveInfo(handle);
		}else{//由隐藏变可见
			handle.setBusinessId(id);
			handle.setErpNo(erpNo);
			tSeniorTechnicianHandleDao.deleteInfo(handle);
		}
	}
}
